<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
    const p = new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve("OK");
        }, 1000);
    });
    
    p.then((val) => {
        return new Promise((resolve, reject) => {
            resolve("OK");
        });
    }, (err) => {
        
    }).then((val)=>{
        console.log(val); // "OK"
    }).then((val)=>{
        console.log(val); // undefined
    });
</script>
</body>
</html>